using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;

namespace TF.Access {
	public partial class TF_UnSheduleCity {
		#region Fields
		private int id;
		private int eventId;
		private int cityId;
		private int lanuageId;
		private string locCode;
		#endregion
		
		#region Constructors
		/// <summary>
		/// Initializes a new instance of the TF_UnSheduleCity class.
		/// </summary>
		public TF_UnSheduleCity() {
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_UnSheduleCity class.
		/// </summary>
		public TF_UnSheduleCity(int eventId, int cityId, int lanuageId, string locCode) {
			this.eventId = eventId;
			this.cityId = cityId;
			this.lanuageId = lanuageId;
			this.locCode = locCode;
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_UnSheduleCity class.
		/// </summary>
		public TF_UnSheduleCity(int id, int eventId, int cityId, int lanuageId, string locCode) {
			this.id = id;
			this.eventId = eventId;
			this.cityId = cityId;
			this.lanuageId = lanuageId;
			this.locCode = locCode;
		}
		#endregion
		
		#region Properties
		/// <summary>
		/// Gets or sets the Id value.
		/// </summary>
		public int Id {
			get { return id; }
			set { id = value; }
		}
		
		/// <summary>
		/// Gets or sets the EventId value.
		/// </summary>
		public int EventId {
			get { return eventId; }
			set { eventId = value; }
		}
		
		/// <summary>
		/// Gets or sets the CityId value.
		/// </summary>
		public int CityId {
			get { return cityId; }
			set { cityId = value; }
		}
		
		/// <summary>
		/// Gets or sets the LanuageId value.
		/// </summary>
		public int LanuageId {
			get { return lanuageId; }
			set { lanuageId = value; }
		}
		
		/// <summary>
		/// Gets or sets the LocCode value.
		/// </summary>
		public string LocCode {
			get { return locCode; }
			set { locCode = value; }
		}
		#endregion
		
		#region Methods
		/// <summary>
		/// Saves a record to the TF_UnSheduleCity table.
		/// </summary>
		public void Insert() {
			id = Convert.ToInt32(SqlClientUtility.ExecuteScalar("TF_UnSheduleCityInsert", eventId, cityId, lanuageId, locCode));
		}
		
		/// <summary>
		/// Selects all records from the TF_UnSheduleCity table.
		/// </summary>
		public static List<TF_UnSheduleCity> SelectAll() {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_UnSheduleCitySelectAll")) {
				List<TF_UnSheduleCity> tF_UnSheduleCityList = new List<TF_UnSheduleCity>();
				while (dataReader.Read()) {
					TF_UnSheduleCity tF_UnSheduleCity = MakeTF_UnSheduleCity(dataReader);
					tF_UnSheduleCityList.Add(tF_UnSheduleCity);
				}
				return tF_UnSheduleCityList;
			}
		}
		
		/// <summary>
		/// Creates a new instance of the TF_UnSheduleCity class and populates it with data from the specified SqlDataReader.
		/// </summary>
		private static TF_UnSheduleCity MakeTF_UnSheduleCity(SqlDataReader dataReader) {
			TF_UnSheduleCity tF_UnSheduleCity = new TF_UnSheduleCity();
			
			if (dataReader.IsDBNull(0) == false) {
				tF_UnSheduleCity.Id = dataReader.GetInt32(0);
			}
			if (dataReader.IsDBNull(1) == false) {
				tF_UnSheduleCity.EventId = dataReader.GetInt32(1);
			}
			if (dataReader.IsDBNull(2) == false) {
				tF_UnSheduleCity.CityId = dataReader.GetInt32(2);
			}
			if (dataReader.IsDBNull(3) == false) {
				tF_UnSheduleCity.LanuageId = dataReader.GetInt32(3);
			}
			if (dataReader.IsDBNull(4) == false) {
				tF_UnSheduleCity.LocCode = dataReader.GetString(4);
			}

			return tF_UnSheduleCity;
		}
		#endregion
	}
}
